/*
 * @Author: huangyq
 * @Date: 2022-03-31 14:25:39
 * @LastEditTime: 2023-12-06 09:50:51
 * @LastEditors: hyq
 * @Description: 配置文件
 * @FilePath: /vue3-boilerplate-pc-client/vite.config.ts
 */
import { defineConfig } from 'vite'
import { resolve } from 'path'
import vue from '@vitejs/plugin-vue'
import eslintPlugin from 'vite-plugin-eslint'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [ElementPlusResolver()]
    }),
    Components({
      resolvers: [ElementPlusResolver()]
    }),
    eslintPlugin({
      include: ['src/**'],
      exclude: ['src/styles/**'],
      cache: false
    })
  ],
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '',
        charset: false
      }
    }
  },
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src')
    }
  },
  server: {
    proxy: {
      '/portal': {
        target: 'http://localhost.cn/',
        changeOrigin: true
      }
    }
  }
})
